document.addEventListener('plusready',function(){
	showWating();
	var ws = plus.webview.currentWebview();
	var uid = plus.storage.getItem('uid');
	$('.set-up-wt').click(function(){
		if(!uid){
			toast('您还未登录请先登录');return;
		}
		goNewPage('free-information-publish.html',{page:ws.id});
	})
	$.ajax({
		type:"get",
		url:apiRoot+"?m=home&c=bbs&a=getAdvice&uid="+uid,
		success :function(data){
			plus.storage.setItem('liuyan',data);
			var datas = $.parseJSON(data);
			plus.nativeUI.closeWaiting();
			if(datas){
				var list = '';
				$.each(datas, function(k,v) {
					list += '<div class="mui-table-view table-view-cell bbs-ico " data-id="'+v.aid+'">'+
								'<div class="overflow-h">'+
									'<i><img src="'+getAvatar(v.avatar)+'"/></i>'+
									'<div>'+
										'<li>'+
											'<span>'+v.name+'</span>'+
											'<span class="mui-h6 mui-pull-right">'+v.addtime+'</span>'+
										'</li>'+
										'<li class="mui-h6">'+v.content+'</li>'+
									'</div>'+
								'</div>'+
							'</div>';
				});
				$('.liuyan').html(list);
				$('.bbs-ico').on('click',function(){
					goNewPage('free-information.html', {aid:$(this).attr('data-id')})
				})
			}
		},
		error :function(e){
			console.log(JSON.stringify(e));
			var ndata = plus.storage.getItem('liuyan');
			var datas = $.parseJSON(ndata);
			if(datas){
				var list = '';
				$.each(datas, function(k,v) {
					plus.nativeUI.closeWaiting();
//					console.log(JSON.stringify(v));
					list += '<div class="mui-table-view table-view-cell bbs-ico " data-id="'+v.aid+'">'+
								'<div class="overflow-h">'+
									'<i><img src="'+getAvatar(v.avatar)+'"/></i>'+
									'<div>'+
										'<li>'+
											'<span>'+v.name+'</span>'+
											'<span class="mui-h6 mui-pull-right">'+v.addtime+'</span>'+
										'</li>'+
										'<li class="mui-h6">'+v.content+'</li>'+
									'</div>'+
								'</div>'+
							'</div>';
				});
				$('.liuyan').html(list);
				$('.bbs-ico').on('click',function(){
					goNewPage('free-information.html',{aid:$(this).attr('data-id')})
				})
			}
		}
	});
},false)